#include "stdafx.h"
#include "DriversInstall.h"
#include "StartProcCmdLineInfo.h"


CStartProcCmdLineInfo::CStartProcCmdLineInfo(void)
{
}


CStartProcCmdLineInfo::~CStartProcCmdLineInfo(void)
{
}


void CStartProcCmdLineInfo::ParseParam(
    const TCHAR* pszParam,
    BOOL bFlag,
    BOOL bLast
    )
{
    CString sParam(pszParam);
    if(bFlag&&(sParam == _T("install"))) {
        theApp.m_bInstallDriver = true;
    } else if(bFlag&&(sParam == _T("uninstall"))) {
        theApp.m_bUninstallDriver = true;
    } else if(bFlag&&(sParam == _T("quiet"))) {
        theApp.m_bQuiet = true;
    } else if(bFlag&&(sParam.Find(_T("inf_file=")) == 0)) {
        int nPos = sParam.Find(_T('=')) + 1;
        sParam = sParam.Mid(nPos);
        theApp.m_sInfFilePath = sParam;
    } else if(bFlag&&((sParam == _T("h")) || (sParam == _T("?")))) {
        theApp.m_bUsageOut = true;
    } else if(bFlag) {
        theApp.m_bParseError = true;
    }
    if(bLast && theApp.m_bInstallDriver && theApp.m_bUninstallDriver)
    {
        theApp.m_bParseError = true;
    }
    if(bLast && theApp.m_bQuiet && (!theApp.m_bInstallDriver) && (!theApp.m_bUninstallDriver))
    {
        theApp.m_bParseError = true;
    }
    if(bLast && theApp.m_bParseError)
    {
        theApp.m_bUsageOut = true;
    }
}
